<template>
  <a-layout v-loading="spinning">
    <a-layout-sider
      width="184"
      v-if="loding"
      :trigger="null"
      collapsible
      v-model="collapsed"
      class="school-sider"
    >
      <div class="logo" :class="collapsed?'logo1':'logo2'"></div>
      <schoolleft v-bind="{collapsed}"></schoolleft>
    </a-layout-sider>
    <a-layout v-if="loding" class="school-right">
      <schoolheader v-bind="{toggleCollapsed,collapsed }"></schoolheader>
      <a-layout-content class="school-content">
        <router-view></router-view>
      </a-layout-content>
    </a-layout>
  </a-layout>
</template>

<script>
import { mapActions } from "vuex";
import schoolleft from "../index/left/index.vue";
import schoolheader from "../index/schoolheader/index.vue";

export default {
  data() {
    return {
      collapsed: false,
      current: ["mail"],
      theme: "dark",
      loding: false,
      spinning: true
    };
  },
  async mounted() {
    let x = await this.session();
    if (!x) {
      this.$message.error("登陆已失效");
      this.$router.push("/login");
    }
    Promise.all([
      this.actionschool(),
      this.actionschooladdress(),
      this.actionschooluser(),
      this.actionschoolclassroom(),
      this.actionschoolrole(),
      this.actionschoolroletype(),
      this.actionschoolcourse(),
      this.actionschoolclasshour(),
      this.actionschoolclazz(),
      this.actionpackegekey(),
      this.actionschoolstudent(),
      this.actionschoolholiday(),
      this.actionschoolclasstime(),
      this.actionschoolhomework(),
      this.actionschoolannouncementpush(),
      this.actionschoolitembankgroup()
    ])
      .then(() => {
        this.spinning = false;
        this.loding = true;
      })
      .catch(e => {
        console.log(e);
      });
  },
  methods: {
    async onPanelChange() {},
    ...mapActions([
      "session",
      "actionschool",
      "actionschooladdress",
      "actionschooluser",
      "actionschoolclassroom",
      "actionschoolrole",
      "actionschoolroletype",
      "actionschoolcourse",
      "actionschoolclasshour",
      "actionschoolclazz",
      "actionpackegekey",
      "actionschoolstudent",
      "actionschoolholiday",
      "actionschoolclasstime",
      "actionschoolhomework",
      "actionschoolannouncementpush",
      "actionschoolitembankgroup"
    ]),
    toggleCollapsed() {
      this.collapsed = !this.collapsed;
    }
  },
  components: {
    schoolleft,
    schoolheader
  }
};
</script>

<style lang="scss" >
@import "@/scss/settings.scss";
@import "@/scss/base.scss";
html,
body,
#app {
  height: 100%;
}
#app .trigger {
  font-size: 18px;
  line-height: 64px;
  padding: 0 24px;
  cursor: pointer;
  transition: color 0.3s;
}
.el-drawer {
  overflow: auto !important;
}
#app .trigger:hover {
  color: #1890ff;
}

#app .logo {
  height: 32px;
  background-repeat: no-repeat;
  background-position-x: center;
  margin: 16px;
  background-size: contain;
  transition: all 0.5s;
}
#app .logo2 {
  background-image: url(https://cdn.hterobot.com/vue/school/image/font-LOGO-1.png);
}

#app .logo1 {
  background-image: url(https://cdn.hterobot.com/vue/school/image/font-LOGO-2.png);
}

#app {
  .el-button {
    position: relative;
  }
  .el-button:hover {
    a::after {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      background: transparent;
      content: "";
    }
  }
  label {
    margin-bottom: 0;
  }
  .el-tree-node__content > .el-checkbox {
    margin-right: 8px;
  }
  .el-table th > .cell {
    vertical-align: top;
  }
  .icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
  }
  .ant-layout {
    height: 100%;
    .school-sider {
      overflow: auto;
      height: 100vh;
      left: 0;
      background-color: $htev1;
      .ant-menu {
        color: $white;
        background-color: rgba(0, 0, 0, 0);
      }
      ul {
        .ant-menu-item-selected {
          background-color: $hteactive;
          color: $white;
        }
        .ant-menu-submenu-title {
          .ant-menu-submenu-arrow::after {
            background-image: none;
          }
          .ant-menu-submenu-arrow::before {
            background-image: none;
          }
        }
      }
    }
    .school-sider::-moz-scrollbar {
      width: 1px;
      height: 4px;
    }
    .school-sider::-moz-scrollbar-thumb {
      border-radius: 5px;
      background: rgba(0, 0, 0, 0.2);
    }
    .school-sider::-moz-scrollbar-track {
      border-radius: 0;
      background: rgba(0, 0, 0, 0.1);
    }
    .school-sider::-webkit-scrollbar {
      width: 1px;
      height: 4px;
    }
    .school-sider::-webkit-scrollbar-thumb {
      border-radius: 5px;
      background: rgba(0, 0, 0, 0.2);
    }
    .school-sider::-webkit-scrollbar-track {
      border-radius: 0;
      background: rgba(0, 0, 0, 0.1);
    }
    .school-right {
      position: relative;
    }
    .school-header {
      position: absolute;
      width: 100%;
      overflow: hidden;
      background-color: $hteheaderc;
      background-image: url("https://cdn.hterobot.com/vue/school/image/LOGO.png");
      background-repeat: no-repeat;
      background-position-x: 250px;
      background-position-y: -35px;
      padding: 0 0;
      .navbar {
        padding: 0 0;
        .navbar-nav {
          color: $white;
        }
        .navbar-brand {
          padding-top: 0;
          padding-bottom: 0;
          color: $white;
          margin-left: 32px;
          height: 60px;
          background-image: url("https://cdn.hterobot.com/vue/school/image/title.png");
          width: 240px;
          background-repeat: no-repeat;
          background-position: center;
        }
        .nav-link {
          padding: 0 0;
        }
        .nav-item {
          padding-left: 10px;
          padding-right: 10px;
        }
        .el-dropdown-link {
          cursor: pointer;
          color: $white;
          .anticon {
            vertical-align: 0.1em;
          }
        }
      }
    }
    .school-content {
      margin-top: 65px;
      height: 100%;
      overflow-y: scroll;
      padding: 12px;
      .school-model-header {
        padding: 20px;
        .school-hangdi {
          display: inline-block;
          width: 3px;
          height: 23px;
          line-height: 23px;
          font-size: 1px;
          color: rgba(0, 0, 0, 0);
          background: rgba(0, 153, 255, 1);
        }
        .school-hangdi-text {
          padding-left: 20px;
          display: inline-block;
          height: 23px;
          font-size: 14px;
          line-height: 23px;
          font-family: Microsoft YaHei;
          font-weight: bold;
          color: rgba(98, 98, 98, 1);
        }
        .school-biaoqian {
          width: 88px;
          height: 100px;
          background: rgba(0, 153, 255, 1);
          box-shadow: 0px 7px 19px 2px rgba(37, 189, 254, 0.31);
          border-radius: 10px;
          margin-left: 10px;
          margin-right: 15px;
          margin-bottom: 15px;
          text-align: center;
          color: #ffffff;
          display: inline-block;
        }
      }
      .school-form {
        .el-dialog__body {
          border-top: 1px solid $htedialogborder;
          border-bottom: 1px solid $htedialogborder;
        }
      }
      .htedialogtext {
        color: $htedialogtext;
        font-weight: bold;
        .el-form-item__label {
          color: $htedialogtext;
          font-weight: bold;
        }
      }
      .school-model {
        background: $whitergba;
        border: 1px solid rgba(242, 243, 245, 1);
        box-shadow: 3px 3px 12px 0px rgba(228, 228, 228, 0.5);
        border-radius: 9px;
        .school-col-table {
          padding-top: 13px;
          padding-bottom: 13px;
        }
      }
      .school-tiao {
        height: 55px;
        padding: 12px;
        .school-tiao-left {
          margin-left: 20px;
          color: #626262;
          height: 24px;
          line-height: 24px;
          border-left: solid 3px #0099ff;
          span: {
            width: 58px;
            height: 15px;
            font-size: 14px;
            font-family: Microsoft YaHei;
            font-weight: bold;
            color: rgba(98, 98, 98, 1);
            display: inline;
          }
        }
      }
    }
    .school-content::-webkit-scrollbar {
      width: 3px;
      height: 4px;
    }
    .school-content::-webkit-scrollbar-thumb {
      background: rgba(0, 0, 0, 0.2);
    }
    .school-content::-webkit-scrollbar-track {
      background: rgba(0, 0, 0, 0.1);
    }
  }
  .el-radio-button {
    margin-bottom: 0;
  }
}
</style>